#include "SYSTEM/delay/delay.h"
#include "SYSTEM/sys/sys.h"
#include "SYSTEM/usart/usart.h"
#include "BSP/LED/led.h"
#include "BSP/BEEP/beep.h"
#include "BSP/KEY/key.h"
#include "BSP/EXTI/exti.h"
#include "BSP/IWDG/wdg.h"
#include "BSP/GTIMER/gtimer.h"
#include "BSP/LCD/lcd.h"

int main()
{
	int x = 0;
	int lcd_id[12];
	
	HAL_Init();
	sys_stm32_clock_init(RCC_PLL_MUL9);
	delay_init(72);
	usart_init(115200);
	led_init();
	lcd_init();
	
	g_point_color = RED;
	sprintf((char *)lcd_id, "LCD ID:%04X", lcddev.id);
	
	while (1)
	{
		switch (x)
		{
			case 0: lcd_clear(WHITE); break;
			case 1: lcd_clear(BLACK); break;
			case 2: lcd_clear(BLUE); break;
			case 3: lcd_clear(RED); break;
			case 4: lcd_clear(MAGENTA); break;
			case 5: lcd_clear(GREEN); break;
			case 6: lcd_clear(CYAN); break;
		}
		lcd_show_string(10, 40, 240, 32, 32, "STM32", RED);
		lcd_show_string(10, 80, 240, 24, 24, "TFTLCD TEST", RED);
		lcd_show_string(10, 110, 240, 16, 16, "ATOM@ALIENTEK", RED);
		lcd_show_string(10, 130, 240, 16, 16, (char *)lcd_id, RED);
		
		x++;
		x = x % 7;
		
		LED0_TOGGLE();
		delay_ms(1000);
	}
}
